#ifndef LOOBYMODEL_H
#define LOOBYMODEL_H

#include <QAbstractListModel>
#include "friend.h"

class LobbyModel : public QAbstractListModel
{
    Q_OBJECT
public:
    // Basic functionality:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    QHash<int, QByteArray> roleNames() const override;

    void refresh(QList<Friend> data);

    void kick_player(QString sid);

    enum LobbyRoles {
        NameRole = Qt::UserRole + 1,
        StateRole,
        SIDRole,
        IsHostRole,
        IsSelfRole,
        SelfIsHostRole
    };
    explicit LobbyModel(QObject *parent = nullptr);
private:
    QList<Friend> lobbyPlayers;
};

#endif // LOOBYMODEL_H
